from django.http import HttpResponse, Http404
from django.shortcuts import render_to_response
from bcdbd.main.models import Barcode, Field

def index(request):
	return render_to_response('main/index.html')

def search(request):
	b = Barcode.objects.filter(barcode=request.GET['barcode'])
	if (len(b) == 0):
		raise Http404
	return render_to_response('main/search.html', {'barcode': b[0], 'fields': Field.objects.filter(barcode=b[0])})